package cn.ym.mall.service.impl;

import cn.ym.mall.dao.AreaDao;
import cn.ym.mall.dao.impl.AreaDaoImpl;
import cn.ym.mall.entity.Area;
import cn.ym.mall.entity.City;
import cn.ym.mall.service.AreaService;
import cn.ym.mall.utils.DruidUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 漆家乐
 */
public class AreaServiceImpl implements AreaService {
    AreaDao areaDao = new AreaDaoImpl();
    /**
     * 查询对应市的区县
     *
     * @return
     * @throws SQLException
     */
    @Override
    public List<Area> getArea(String fatherId) throws SQLException {
        Connection conn = null;
        List<Area> areaList = new ArrayList<>();
        try {
            conn = DruidUtils.getConnection();
            areaList = areaDao.getArea(fatherId);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            DruidUtils.close();
        }
        return areaList;
    }
}
